﻿<!-- Copyright (c) Christof Senn. All rights reserved. See license.txt in the project root for license information. -->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!-- control styles -->
    <Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator Background="Transparent" SnapsToDevicePixels="False">
                        <BulletDecorator.Bullet>
                            <Grid Opacity="{TemplateBinding Opacity}">
                                <Border 
                                    x:Name="Border"
                                    Width="13"
                                    Height="13"
                                    CornerRadius="0"
                                    BorderThickness="1" 
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    Background="{TemplateBinding Background}">
                                </Border>
                                <Path 
                                    x:Name="CheckMark" 
                                    Visibility="Collapsed" 
                                    Margin="3 -2 -3 2"
                                    Width="13" Height="13"
                                    SnapsToDevicePixels="False"
                                    StrokeThickness="1"
                                    Data="M 12.4227,0.00012207C 12.4867,0.126587 12.5333,0.274536 
                                    12.6787,0.321411C 9.49199,3.24792 6.704,6.57336 
                                    4.69865,10.6827C 4.04399,11.08 3.47066,11.5573 2.83199,
                                    11.9706C 2.09467,10.2198 1.692,8.13196 3.8147e-006,
                                    7.33606C 0.500004,6.79871 1.31733,6.05994 1.93067,6.2428C 
                                    2.85999,6.51868 3.14,7.9054 3.60399,8.81604C 5.80133,
                                    5.5387 8.53734,2.19202 12.4227,0.00012207 Z ">
                                    <Path.Fill>
                                        <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                                    </Path.Fill>
                                    <Path.Stroke>
                                        <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                                    </Path.Stroke>
                                </Path>
                                <Rectangle 
                                    x:Name="InderminateMark"
                                    Visibility="Collapsed"  
                                    Stroke="Transparent" 
                                    Width="5" Height="5"
                                    SnapsToDevicePixels="False">
                                    <Rectangle.Fill>
                                        <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                                    </Rectangle.Fill>
                                </Rectangle>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="CheckMark">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InderminateMark">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter 
                            Margin="4 0 0 0"
                            VerticalAlignment="Center"
                            HorizontalAlignment="Left"
                            RecognizesAccessKey="True"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                    </BulletDecorator>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>